#![no_std]
#![no_main]

#![feature(custom_test_frameworks)]
#![test_runner(rustos::test_runner)] // set test runner
#![reexport_test_harness_main = "test_main"] // set test entry

use core::panic::PanicInfo;
use rustos::println;

#[cfg(not(test))]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
  println!("{}", info);
  loop {}
}

#[cfg(test)]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
  rustos::test_panic_handler(info)
}

#[no_mangle]
pub extern "C" fn _start() -> ! {
  println!("hello{} world", ",");

  rustos::init();

  unsafe {
    *(0xdeadbeef as *mut u8) = 42;
  }

  #[cfg(test)]
  test_main();

  println!("It did not crash!");
  loop {}
}
